26ff2ec8a51421e15acf032bd7f19968ca1697a7,samples/rest-notes-spring-hateoas/src/test/java/com/example/notes/ApiDocumentation.java,ApiDocumentation,notesCreateExample,#,168
Before Change
ConstrainedFields fields = new ConstrainedFields(NoteInput.class);
this.document.snippets(
requestFields(
fields.withPath("title").description("The title of the note"),
fields.withPath("body").description("The body of the note"),
fields.withPath("tags").description("An array of tag resource URIs")));
this.mockMvc.perform(
post("/notes").contentType(MediaTypes.HAL_JSON).content(
this.objectMapper.writeValueAsString(note)))
.andExpect(status().isCreated());
}
@Test
After Change
.perform(post("/notes")
.contentType(MediaTypes.HAL_JSON)
.content(this.objectMapper.writeValueAsString(note)))
.andExpect(
status().isCreated())
.andDo(this.documentationHandler.document(
requestFields(
fields.withPath("title").description("The title of the note"),
fields.withPath("body").description("The body of the note"),
fields.withPath("tags").description("An array of tag resource URIs"))));
}
@Test